package world.criver.imagecompresstool.data;

import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import world.criver.imagecompresstool.contorller.conMaster;

import java.io.File;
import java.util.ArrayList;

public class daValue {
    /**
     * 安装路径
     */
    public static String bin_url="";
    public static String[] commands=null;
    public static long click_time=0;
    public static Stage master=null;
    public static Stage pop_menu=null;
    public static Stage pop_parent=null;
    public static conMaster conMaster;
    public static ArrayList<Long> pops=new ArrayList<>();
    public static void iniBinUrl(){
        try {
            File f = new File("_ic_");
            if (!f.exists() || f.isDirectory()) f.createNewFile();
            bin_url = f.getAbsolutePath().replace("\\_ic_","");
        }catch (Exception e){
            throw new RuntimeException(e);
        }
    }
    public static void openPop(double x,double y){
        Platform.runLater(()->{
            pop_parent.show();
            pop_menu.show();
            pop_parent.setX(x);
            pop_parent.setY(y-pop_menu.getHeight()-8);
            pop_menu.setX(x);
            pop_menu.setY(y-pop_menu.getHeight()-8);
        });
    }
    public static void hidePop(){
        Platform.runLater(()->{
            pop_menu.hide();
            pop_parent.hide();
        });
    }
    public static void openMaster() {
        Platform.runLater(() -> {
            master.show();
            click_time = 0;
            conMaster.onMenu1();
        });
    }
}
